__auth__ = "miao.zhifeng<19195659@qq.com>"
__doc__ = """ 
常用的字符、字符串操作
"""
#1. 字符串的拼接
s1 = "hello "
s2 = "python"
s = s1 + s2 # => "hello python"

#2. 字符串的重复拼接
s3 = "#"
s = s3*4  # => "####"

#3. 字符串的长度
len("你好 python") #返回字符串中unicode字符的个数 9, 与python2有不同

#4.判断字符串组成的字符类型
# isdigit - 字符串全部由数字组成？
"123".isdigit()  # return True
"123s".isdigit() # retuan False

#5. 字符串格式化输出format
s = "你好，{0}和{1}".format("数学","Python")
print(s)

#6. 再复杂些，输出1-10的平方，立方，并按照格式输出
for x in range(1, 11):
	print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))
#结果如下
"""
 1   1    1
 2   4    8
 3   9   27
 4  16   64
 5  25  125
 6  36  216
 7  49  343
 8  64  512
 9  81  729
10 100 1000
"""
#7. 再灵活些
print('The story of {0}, {1}, and {other}.'.format('Bill', 
	'Manfred',other='Georg'))
#  输出	The story of Bill, Manfred, and Georg.